#ifndef _TES_PLANE_H_
#define _TES_PLANE_H_
#include "assert.h"
#include "TesVector3.h"

#ifndef IS_ZERO 
#define ZERO(X) ( X < 0.000001f && X > -0.000001f)
#define IS_ZERO ZERO
#endif

class TesRay;
class TesAABB3;

class TesPlane {
public:
	TesVector3 Normal;
	float d;

	TesPlane();
	TesPlane(const TesVector3& normal, const float& d);
	TesPlane(const float& NorX, const float& NorY, const float& NorZ, const float& d);
	TesPlane(const TesVector3* Points, int n);
	bool CheckPtIn(const TesVector3& pt);
	bool CheckPtIn(float x, float y, float z);
	float getDistanceFromPt(TesVector3& pt);
	TesVector3 getNearestPoint(TesVector3& Point);
	bool checkPtIn(TesVector3& Point);
	bool Collide(TesRay& Ray, TesVector3* hitPos);
	bool Collide(TesAABB3& aabb);
};

#endif